===================
SiriDB supports multiple build-in aggregation and filter functions. Using these functions can be useful to reduce network traffic. Note that multiple functions can be combined using the arrow `=>` sign. (see `help select` for more information on how to use and combine functions)
+Most aggregation function accept an optional `ts` argument. When not providing the `ts` argument, SiriDB will usually return the last timestamp in the result. One exception is the `first()` function which will return the first timestamp instead.
+
+For example:
+
+ # Select the last time-stamp and the average over all values.
+ select mean() from `my_series`
+
+ # Select the first time-stamp and first value:
+ select first() from `my_series`
+
List of supported aggregation and filter functions:
limit
-----
Syntax:
- count(ts)
+ count([ts])
Returns an integer value.
---
Syntax:
- sum(ts)
+ sum([ts])
Returns an integer or float value depending on the series data type.
---
Syntax:
- max(ts)
+ max([ts])
Returns an integer or float value depending on the series data type.
---
Syntax:
- min(ts)
+ min([ts])
Returns an integer or float value depending on the series data type.
----
Syntax:
- mean(ts)
+ mean([ts])
Returns a float value.
------
Syntax:
- median(ts)
+ median([ts])
Returns a float value.
-----------
Syntax:
- median_high(ts)
+ median_high([ts])
Returns an integer or float value depending on the series data type.
-----------
Syntax:
- median_low(ts)
+ median_low([ts])
Returns an integer or float value depending on the series data type.
--------
Syntax:
- variance(ts)
+ variance([ts])
Returns a float value.
---------
Syntax:
- pvariance(ts)
+ pvariance([ts])
Returns a float value.
# Select all positive values from 'series-001'
select filter(> 0) from 'series-001'
+
+
+first
+-----
+Syntax:
+
+ first([ts])
+
+Returns the first value in each `ts` time window. (Or just the first value)
+
+Example:
+
+ # Select the first value from 'series-001'
+ select first() from 'series-001'
+
+ # Select the first value per day from 'series-001'
+ select first(1d) from 'series-001'
+
+ # Select the first value in 2018 from 'series-001'
+ select first() from 'series-001' after '2018'
+
+
+last
+----
+Syntax:
+
+ last([ts])
+
+Returns the last value in each `ts` time window. (Or just the last value)
+
+Example:
+
+ # Select the last value from 'series-001'
+ select last() from 'series-001'
+
+ # Select the last value per day from 'series-001'
+ select last(1d) from 'series-001'
+
+ # Select the last value in 2017 from 'series-001'
+ select last() from 'series-001' before '2018'
\ No newline at end of file
Valid columns are:
- active_handles: Returns the active handles which can be used as an indicator on how busy a server is.
+- active_tasks: Returns the active tasks for the current database.
- address: Server address.
- buffer_path: Path where this server keeps the buffer file.
- buffer_size: Size the server uses for one series in the buffer.
- dbpath: Path where the server stores the database.
- fifo_files: Number of fifo files which are used to update the replica server. This value is 0 if the server has no replica. A value greater than 1 could be an indication that replication is not working.
+- idle_percentage: Returns percentage of idle time since the database was loaded.
+- idle_time: Returns the idle time in seconds since the database was loaded.
- ip_support: IP Support setting on the server. (ALL/ IPV4ONLY/ IPV6ONLY)
- libuv: Version of libuv library.
- log_level: Current loglevel for the server.
See available options for more info on each show command:
- `show active_handles`: Returns the active handles which can be used as an indicator for how busy a server is.
+- `show active_tasks`: Returns the active tasks for the current database.
- `show buffer_path`: Returns the local buffer path on *this* server.
- `show buffer_size`: Returns the buffer size in bytes on *this* server.
- `show dbname`: Returns the database name.
- `show duration_log`: Returns the sharding duration for log data on *this* database (not supported yet).
- `show duration_num`: Returns the sharding duration for num data on *this* database.
- `show fifo_files`: Returns the number of fifo files which are used to update the replica server. This value is 0 if the server has no replica. A value greater than 1 could be an indication that replication is not working.
+- `show idle_percentage`: Returns percentage of idle time since the database was loaded.
+- `show idle_time`: Returns the idle time in seconds since the database was loaded.
- `show ip_support`: Returns the ip support setting on *this* server.
- `show libuv`: Returns the version of libuv on *this* server.
- `show list_limit`: Returns the maximum value which can be used as limit in a list query.